<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>布置作业</title>
</head>
<body>
	<?php 
	$con = @mysql_connect("localhost","root","");
	if (!$con)
	{
		die('Could not connect: ' . mysql_error());
	}

	mysql_select_db("data", $con);

	if ($_POST['homework'] == Null) {
		echo "Can't insert Null values!<br/>点击<a href='../teacher.html'>返回</a>！";
	}
	else{
		$sql="INSERT INTO homework_assignment (h_name) VALUES ('$_POST[homework]')";

		if (!mysql_query($sql,$con))
		{
			die('Error: ' . mysql_error());
		}
		echo "作业布置成功，点击<a href='../teacher.html'>返回</a>！";
	}
	

	mysql_close($con)
	?>
</body>
</html>